﻿using System;

using System.Management.Automation;
using CrystalDecisions.Enterprise.Desktop;

namespace BO.Management.PowerShell
{
    [Cmdlet(VerbsCommon.Get, "Shortcut", DefaultParameterSetName = CONNECT_SECWINAD)]
    public class GetShortcut : BaseGetObject<ShortcutProvider, Shortcut>
    {

        [Parameter(ParameterSetName = CONNECT_SECENTERPRISE, Mandatory = false, ValueFromPipeline = true)]
        [Parameter(ParameterSetName = CONNECT_SECWINAD, Mandatory = false, ValueFromPipeline = true)]
        public Int32? TargetId { get; set; }

        public override ShortcutProvider GetProvider()
        {
            return new ShortcutProvider(this.LogonProvider);
        }

        /// <summary>
        /// Add search by Target Id
        /// </summary>
        protected override void FindBoeObject()
        {
            if (TargetId.HasValue)
                BoeProvider.AddFilterToTargetId(this.TargetId.Value);

            base.FindBoeObject();
        }

    }
}
